<template>
    <div class="layout">
        <header class="header">
            <nav class="nav">
                <div class="logo">
                    <NuxtLink to="/">
                        <img src="../assets/images/logo.png" alt="Logo" class="logo-img" />
                    </NuxtLink>
                </div>
                <div class="nav-container">
                    <div class="nav-links">
                        <NuxtLink to="/" class="nav-link">官网首页</NuxtLink>
                        <NuxtLink to="/foreign-ip" class="nav-link">国外IP代理</NuxtLink>
                        <NuxtLink to="/dynamic-ip" class="nav-link">动态IP</NuxtLink>
                        <NuxtLink to="/static-ip" class="nav-link">静态IP</NuxtLink>
                        <NuxtLink to="/news" class="nav-link">资讯</NuxtLink>
                        <NuxtLink to="/tools" class="nav-link">代理工具</NuxtLink>
                    </div>
                </div>
            </nav>
        </header>

        <main class="main">
            <slot />
        </main>

        <footer class="footer">
            <div class="footer-content">
                <div class="footer-left">
                    <img src="../assets/images/logo.png" alt="Logo" class="footer-logo" />
                    <p class="company-info">专业的HTTP代理服务提供商</p>
                </div>
                <div class="footer-links">
                    <div class="link-group">
                        <h4>产品服务</h4>
                        <NuxtLink to="/foreign-ip">国外IP代理</NuxtLink>
                        <NuxtLink to="/dynamic-ip">动态IP</NuxtLink>
                        <NuxtLink to="/static-ip">静态IP</NuxtLink>
                    </div>
                    <div class="link-group">
                        <h4>帮助支持</h4>
                        <NuxtLink to="/tools">代理工具</NuxtLink>
                        <NuxtLink to="/news">资讯</NuxtLink>
                        <a href="mailto:support@example.com">联系我们</a>
                    </div>
                </div>
            </div>
            <div class="footer-bottom">
                <p>&copy; 2024 您的公司名称 版权所有</p>
            </div>
        </footer>
    </div>
</template>

<style scoped>
.layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 16px;
}

.nav {
    width: clamp(1200px, 85%, 1800px);
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 40px;
    border-radius: 8px;
    margin-top: 8px;
}

.logo {
    flex-shrink: 0;
    flex: 1;
}

.logo-img {
    height: 40px;
    width: auto;
    transition: transform 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.05);
}

.nav-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 16px;
}

.nav-link {
    color: #333;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.3s;
    padding: 8px 16px;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #1976d2;
    background-color: rgba(25, 118, 210, 0.04);
}

.nav-link.router-link-active {
    color: #1976d2;
    background-color: rgba(25, 118, 210, 0.08);
    font-weight: 600;
}

@keyframes navLinkFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-box {
    display: flex;
    align-items: center;
    margin-left: 24px;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    width: 200px;
    outline: none;
}

.search-input:focus {
    border-color: #1976d2;
}

.search-btn {
    padding: 8px 16px;
    background: #1976d2;
    border: none;
    border-radius: 0 4px 4px 0;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

.search-btn:hover {
    background: #1565c0;
}

.search-icon {
    font-style: normal;
}

.main {
    flex: 1;
    margin-top: 64px; /* 头部高度 */
    margin-bottom: 40px;
}

.footer {
    background: #ffffff;
    border-top: 1px solid #eee;
    padding: 40px 0;
    margin-top: auto;
}

.footer-content {
    width: clamp(1200px, 85%, 1800px);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.footer-left {
    max-width: 300px;
}

.footer-logo {
    height: 32px;
    width: auto;
    margin-bottom: 16px;
}

.company-info {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
}

.link-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-group h4 {
    color: #222;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.link-group a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.link-group a:hover {
    color: #1976d2;
}

.footer-bottom {
    width: clamp(1200px, 85%, 1800px);
    margin: 0 auto;
    margin-top: 40px;
    padding: 20px 24px 0;
    border-top: 1px solid #eee;
}

.footer-bottom p {
    text-align: center;
    font-size: 14px;
    color: #666;
}
</style> 

<script>
export default {
    data() {
        return {
            searchQuery: ''
        }
    },
    methods: {
        handleSearch() {
            if (!this.searchQuery.trim()) return
            
            // 可以选择以下任一方式处理搜索：
            
            // 1. 跳转到搜索结果页
            this.$router.push({
                path: '/search',
                query: { q: this.searchQuery }
            })
            
            // 2. 或者直接调用搜索 API
            // try {
            //     const response = await fetch(`/api/search?q=${this.searchQuery}`)
            //     const results = await response.json()
            //     // 处理搜索结果...
            // } catch (error) {
            //     console.error('搜索失败:', error)
            // }
        }
    }
}
</script> 